<!DOCTYPE html>
<html class="x-admin-sm" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>高校健康云</title>

</head>
<header th:replace="header::html"></header>
<body>
<!--<div class="formdiv">
    <form class="layui-form layui-form-pane" action="/report/add" method="post">
        <div class="layui-form-item">
            <label class="layui-form-label">用户id</label>
            <div class="layui-input-block">
                <input type="text" name="userId" value="1" required  lay-verify="required" placeholder="请填写用户ID" autocomplete="off" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">信息备注</label>
            <div class="layui-input-block">
                <input type="text" name="remark" required lay-verify="required" placeholder="备注填写" autocomplete="off" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item" pane>
            <label class="layui-form-label">体温状态</label>
            <div class="layui-input-block" style="background-color: white">
                <input type="radio" name="temperature" value="NORMAL" title="正常" checked>
                <input type="radio" name="temperature" value="LOW" title="低温">
                <input type="radio" name="temperature" value="HEIGHT" title="高温">
            </div>
        </div>
        <div class="layui-form-item" pane>
            <label class="layui-form-label">近期动向</label>
            <div class="layui-input-block" style="background-color: white">
                <input type="radio" name="travel" value="0" title="没有旅游" checked>

                <input type="radio" name="travel" value="1" title="有旅游">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">途径城市</label>
            <div class="layui-input-block">
                <input type="text" name="travelDescription" required  lay-verify="required" placeholder="请填写途径城市" autocomplete="off" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">风险接触</label>
            <div class="layui-input-block">
                <input type="text" name="physicalCondition" required  lay-verify="required" value="contact,normal" autocomplete="off" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item" align="center">
            <div class="layui-input-block">
                <button class="layui-btn" lay-submit lay-filter="formDemo">立即提交</button>
                <button type="reset" class="layui-btn layui-btn-primary">重置</button>
            </div>
        </div>
    </form>
</div>

    <script>
        //Demo
        layui.use('form', function(){
            var form = layui.form;

            /*//监听提交
            form.on('submit(formDemo)', function(data){
                layer.msg(JSON.stringify(data.field));
                return false;
            });*/
        });
    </script>-->

<form class="layui-form" action="">
    <div class="layui-form-item">
        <label class="layui-form-label">
            <!--<span class="x-red">*</span>-->个人体温情况
        </label>

        <div class="form-temperature layui-input-block">
            <input name="temperature" type="radio" th:each="c:${dict['temperature']}" th:title="${c.dictValue}" th:value="${c.dictKey}">

        </div>
    </div>
  <!--  <div class="layui-form-item">
        <label class="layui-form-label">个人体温情况</label>
        <div class="layui-input-block">
            <select name="city" lay-verify="required">
                <option value=""></option>
                <option value="0">正常37.3°C</option>
                <option value="1">低热37.3-37.9°C</option>
                <option value="2">中热38-39°C</option>
                <option value="3">高热39°C以上</option>
            </select>
        </div>
    </div>-->

    <div class="layui-form-item">
        <label class="layui-form-label">是否有下列情况？（可多选）</label>
        <div class="layui-input-block">
           <!-- <input type="checkbox" name="like[write]" title="14天内曾居住或前往疫情高发地"><br/>
            <input type="checkbox" name="like[read]" title="两周内有于确诊患者解除"><br/>
            <input type="checkbox" name="like[dai]" title="没有出现症状"><br/>
            <input type="checkbox" name="" title="感冒样症状：乏力、精神差、咳嗽、发烧、肌肉痛、头痛"><br/>
            <input type="checkbox" name="" title="喘憋、呼吸急促"><br/>
            <input type="checkbox" name="" title="恶心呕吐、腹泻"><br/>
            <input type="checkbox" name="" title="心慌、胸闷"><br/>
            <input type="checkbox" name="" title="结膜炎（红眼病样表现：眼睛涩、红、分泌物）">-->
            <input type="checkbox" name="physicalCondition" th:each="c:${dict['physical_condition']}"
                   th:value="${c.dictKey}" th:title="${c.dictValue}">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">近期动向</label>
        <div class="layui-input-block">
         <!--   <input type="radio" name="sex" value="有旅游" title="有旅游">
            <input type="radio" name="sex" value="没有旅游" title="没有旅游" checked>
        </div>
        <div class="layui-form-mid layui-word-aux">最近一个月是否有国外/省外旅游史</div>
    </div>
    <div class="layui-form-item layui-form-text">
        <label class="layui-form-label">近期行程描述</label>
        <div class="layui-input-block">
            <textarea name="desc" placeholder="请输入内容" class="layui-textarea"></textarea>
            <div class="layui-form-mid layui-word-aux">情况描述(无相关症状者选填)</div>
        </div>-->
            <input type="radio" name="travel"  th:each="c:${dict['travel']}"
                   th:value="${c.dictKey}" th:title="${c.dictValue}">
        </div>
    </div>

    <div class="layui-form-item layui-form-text">
            <label class="layui-form-label">近期行程描述</label>
            <div class="layui-input-block">
                <textarea name="travelDescription" placeholder="请输入内容" class="layui-textarea"></textarea>
            </div>
    </div>

    <div class="layui-form-item">
        <div class="layui-input-block">
            <button class="layui-btn" lay-submit lay-filter="formDemo">立即提交</button>
            <button type="reset" class="layui-btn layui-btn-primary">重置</button>
        </div>
    </div>
</form>
<script>
    //Demo
    layui.use('form', function(){
        var form = layui.form;

        //监听提交
        form.on('submit(formDemo)', function(data){
            $ = layui.jquery;
            var arr_box = [];
            $('input[type=checkbox]:checked').each(function() {
                arr_box.push($(this).val());
            });
            //数组
            data.field["physicalCondition"] = arr_box.join(",")
            // ajax 传输数据
            $.ajax({
                url:"/report/add",
                type:"POST",
                contentType: "application/json; charset=utf-8",
                data:JSON.stringify(data.field),
                dataType:'json',
                success:function(result){
                    layer.alert("添加成功", {icon: 6},function (index1) {
                        layer.close(index1);
                        location.reload()
                    });
                }
            });
            return false;
        });
    });

</script>
</body>
</html>